﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SplitCode;

namespace TiffSplit
{
    public partial class Options : Form
    {
        public ConfObj Configs { get; private set; }

        public Options(ConfObj configObj)
        {
            InitializeComponent();

            radioButton_tif.Checked = configObj.outputType == OutputType.TIF;
            radioButton_jpg.Checked = configObj.outputType == OutputType.JPG;
            numericUpDown_jpegQ.Value = configObj.quality;

            Configs = configObj;
        }

        private void radioButton_jpg_CheckedChanged(object sender, EventArgs e)
        {
                numericUpDown_jpegQ.Enabled = (sender as RadioButton).Checked;
        }

        private void button_cancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void button_ok_Click(object sender, EventArgs e)
        {
            Configs.outputType = radioButton_tif.Checked ? OutputType.TIF : OutputType.JPG;
            Configs.quality = numericUpDown_jpegQ.Value;
            Configs.doOverwrite = false;
            DialogResult = DialogResult.OK;
            Close();
        }

        private void linkLabel_iTextPdf_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("IExplore", "http://www.itextpdf.com/");
        }
    }
}
